package cn.gz.demo.ui.banner;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bigkoo.convenientbanner.holder.Holder;

import cn.gz.demo.utils.glide.GlideUtil;

/**
 * Created by Sai on 15/8/4.
 * 网络图片加载例子
 */
public class NetworkImageHolderView implements Holder<BannerImageInfo> {
    private ImageView imageView;
    private Activity activity;

    public NetworkImageHolderView(Activity activity) {
        this.activity = activity;
    }

    @Override
    public View createView(Context context) {
        //你可以通过layout文件来创建，也可以像我一样用代码创建，不一定是Image，任何控件都可以进行翻页
        imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setEnabled(false);
        return imageView;
    }

    @Override
    public void UpdateUI(Context context, int position, BannerImageInfo data) {
        GlideUtil.loadPicWithCash(context,data.getImage(),imageView);
    }
}
